MEN-9322 + partial MEN-9001 - deployment creation things - #2144
Conversation
Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
… utils Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
…d design Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
…se definitions - also mode conversion + basic phase management actions Ticket: MEN-9001 Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
Ticket: MEN-9001 Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
…ions Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
…ions Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
- extracted phase payload assembly to reduce cognitive complexity Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
…lying component - also added type infos Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
- also adjusted docs links appearance & targets - let date time picker rely on the commonly used format to increase alignment Ticket: MEN-9322 Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
- this handles rollout pattern, pause settings & device limit expansion explicitly Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
…rrors Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
Ticket: MEN-9322 Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
…ng & design Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
mineralsfree
left a comment
There was a problem hiding this comment.
a few things I noticed, some of them worth fixing before merging IMO
| const { hasError, hasWarning } = messages.reduce( | ||
| (accu, { severity }) => ({ hasError: accu.hasError || severity === 'error', hasWarning: accu.hasWarning || severity === 'warning' }), | ||
| { hasError: false, hasWarning: false } | ||
| ); |
There was a problem hiding this comment.
Maybe
const hasError = messages.some(({ severity }) => severity === 'error');
const hasWarning = messages.some(({ severity }) => severity === 'warning');
| const percentage = phases.reduce((accu, phase, index, source) => { | ||
| if (index === source.length - 1) { | ||
| return accu; | ||
| } | ||
| return phase.batch_size ? accu - phase.batch_size : accu; |
There was a problem hiding this comment.
consider
phases.slice(0, -1).reduce((accu, { batch_size_devices = 0 }) => accu + batch_size_devices, 100);
| return `${toFixedWithoutRounding(number)}K`; | ||
| } | ||
| return count.toLocaleString(); | ||
| }; |
There was a problem hiding this comment.
Maybe we could use something like
const deviceCountFormatter = new Intl.NumberFormat('en-US', { notation: 'compact', roundingMode: 'trunc' });
export const formatDeviceCount = (count: number): string => (Number.isFinite(count) && count >= 0 ? deviceCountFormatter.format(count) : '0');
instead?
| <TableCell> | ||
| {!isLast && phases.length > 1 ? ( | ||
| <div className="flexbox"> | ||
| <IconButton onClick={() => repeatPhase(index)} title="Repeat phase"> |
There was a problem hiding this comment.
Maybe disable/remove when phase > 50%? Replacing all consequent phases might be not what user expects
| it('prefers the smallest whole-number unit', () => { | ||
| expect(parseInterval('86400s')).toEqual({ delay: 1, delayUnit: delayUnits.days }); | ||
| expect(parseInterval('7200s')).toEqual({ delay: 2, delayUnit: delayUnits.hours }); | ||
| expect(parseInterval('5400s')).toEqual({ delay: 30, delayUnit: delayUnits.minutes }); |
There was a problem hiding this comment.
5400s is more than 30 minutes. 😄 parseInterval has incorrect implementation
| isPercentageMode={isPercentageMode} | ||
| hasError={hasError} | ||
| max={max} | ||
| disabled={isLast && deviceCount >= 1} |
There was a problem hiding this comment.
I think we should not allow editing the last phase even if deviceCount == 0
| const phaseObject = { | ||
| 'Phase start time': <Time value={startTime} />, | ||
| 'Batch size': `${batchSize}%${deviceCountText}` | ||
| 'Batch size': isPercentageMode ? `${batchSize}%${deviceCountText}` : batchSize |
There was a problem hiding this comment.
maybe : ${batchSize} ${pluralize('device', deviceCount)}
| const prefix = 'Uniform: '; | ||
| let phasesDescription = ''; | ||
| if (isPercentageMode) { | ||
| phasesDescription = `${batch_size}% per phase, ${delay}${delayUnit || delayDefaults.delayUnit} intervals`; |
There was a problem hiding this comment.
${delay} ${delayUnit || delayDefaults.delayUnit}
maybe add space
| <ErrorOutlineIcon fontSize="small" style={{ marginRight: 4, top: 4, color: 'rgb(171, 16, 0)' }} /> | ||
| <InfoText> | ||
| <FormHelperText className="flexbox align-items-center"> | ||
| <ErrorOutlineIcon className=" margin-right-x-small" fontSize="small" color="error" /> |
There was a problem hiding this comment.
| <ErrorOutlineIcon className=" margin-right-x-small" fontSize="small" color="error" /> | |
| <ErrorOutlineIcon className="margin-right-x-small" fontSize="small" color="error" /> |
| return accu; | ||
| } | ||
| return phase.batch_size ? accu - phase.batch_size : accu; | ||
| }, 100); |
There was a problem hiding this comment.
maybe phaseLimits.fullBatchPercentage instead of 100
No description provided.